package com.matt.foundation.vo;

import com.matt.foundation.constant.StaffConstant;
import com.matt.foundation.utils.DateUtil;
import lombok.Data;

import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/11/13
 * *******************************
 */
@Data
public class StaffPageVo {
    private String id;
    private String name;
    private String roleName;
    private String lastLoginTime;
    private String mobile;
    private String status;

    public static StaffPageVo of(Object[] objects) {
        StaffPageVo vo = new StaffPageVo();
        vo.setId(objects[0] == null ? "" : objects[0].toString());
        vo.setName(objects[1] == null ? "" : objects[1].toString());
        vo.setRoleName(objects[2] == null ? "" : objects[2].toString());
        vo.setLastLoginTime(objects[3] == null ? "" : DateUtil.millisToDateTime(((Date)objects[3]).getTime(), "yyyy-MM-dd HH:mm:ss"));
        vo.setMobile(objects[4] == null ? "" : objects[4].toString());
        vo.setStatus(objects[5] == null ? "" : StaffConstant.Status.NORMAL.get(Integer.valueOf(objects[5].toString())).valueOf());
        return vo;
    }
}
